package com.jnxx.task.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jnxx.basic.domain.BaseDomain;
import com.jnxx.okr.domain.Okr;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;

/**
 *  任务
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Task extends BaseDomain{

    /**
     * 任务名称
     */
    @NotBlank(message = "名称不能为空!")
    private String taskName;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date creatTime;
    /**
     * 任务结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endTime;
    /**
     * 任务开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startTime;
    // 完成时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date finishTime;
    /**
     * 任务级别
     */
    private String taskLevel;
    /**
     * 任务详情
     */
    private String taskDetail;
    // 附件
    private String annex;
    // 确认状态
    private String sureState;
    // 创建人id
    private Long creatStaffId;
    // 负责人评价
    private Long myStart;
    // 领导评价评价
    private Long leaderStart;
    /**
     * 任务进度
     */
    @Min(value = 0, message = "必须大于等于0")
    @Max(value = 100, message = "必须小于等于100")
    private String taskProgress;
    /**
     * 负责人id
     */
    private Long staffId;

    private Boolean states;

    private List<Comment> comment;

    private String taskType;

    private Long cardId;

    private Long moduleId;

    private Long projectId;
    private Long okrId;
    private Long krId;

    private Okr okr;
    // 对齐id
    private Long alignmentId;
    // 项目/模块/卡片
    private String projectDetails;
    // 成员id
    private Integer[] ids = new Integer[0];
    // 参与成员
    private List<OkrStaff> staffList;
    //  负责人
    private OkrStaff leader;
    private OkrStaff staff;

    public Long getMyStart() {
        return myStart;
    }

    public Long getLeaderStart() {
        return leaderStart;
    }

    public Task(String taskName, Date creatTime, String sureState, Long staffId, String taskLevel) {
        this.taskName = taskName;
        this.creatTime = creatTime;
        this.sureState = sureState;
        this.staffId = staffId;
        this.taskLevel = taskLevel;
    }
}
